<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script>
        function showTime(){
            var date = new Date();
            var day = date.getDay();
            var weekday=["星期日","星期一","星期二","星期三","星期四","星期五","星期六"];
            var year = date.getFullYear();
            var month = date.getMonth()+1;
            var d = date.getDate();
            var hours = date.getHours();
            var minutes = date.getMinutes();
            var seconds = date.getSeconds();
            var str = "当前时间为："+year + "年 "+ month+"月 "+d + "日 " + hours + "时 "+minutes+"分 "+seconds + "秒" + "\n"+weekday[day];
            document.getElementById("now").innerText = str;
            setInterval("showTime()",1000);
        }
    </script>
</head>
<body onload="showTime()">
<p>1:实现时间的动态显示功能，
    要求能显示星期几，年月日，小时分钟秒</p>
<p id="now"></p>
</body>
</html>